#include "DeaconsWidget.h"

void DeaconsWidget::loadQuorum()
{
	quorum1->setText(QString("%1").arg(m_youth->deacons().quorum().req1()));
	quorum2->setText(QString("%1").arg(m_youth->deacons().quorum().req2()));
	quorum3->setText(QString("%1").arg(m_youth->deacons().quorum().req3()));
	quorum4->setText(QString("%1").arg(m_youth->deacons().quorum().req4()));
	quorum5->setText(QString("%1").arg(m_youth->deacons().quorum().req5()));
	quorum6->setText(QString("%1").arg(m_youth->deacons().quorum().req6()));
	quorum7->setText(QString("%1").arg(m_youth->deacons().quorum().req7()));
}

void DeaconsWidget::on_quorum1_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq1(percent);
	updateCompletions();
}

void DeaconsWidget::on_quorum2_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq2(percent);
	updateCompletions();
}

void DeaconsWidget::on_quorum3_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq3(percent);
	updateCompletions();
}

void DeaconsWidget::on_quorum4_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq4(percent);
	updateCompletions();
}

void DeaconsWidget::on_quorum5_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq5(percent);
	updateCompletions();
}

void DeaconsWidget::on_quorum6_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq6(percent);
	updateCompletions();
}

void DeaconsWidget::on_quorum7_textChanged(const QString& i_percent)
{
    int percent = i_percent.toInt();
    if (percent > 100) percent = 100;
	m_youth->deacons().quorum().setReq7(percent);
	updateCompletions();
}
